﻿using HCMS.Utils;

namespace HCMS.CommonDtos
{
    /// <summary>
    /// Ajax 结果 Dto
    /// </summary>
    public class AjaxResultDto
    {
        public AjaxResultDto()
        {

        }

        public AjaxResultDto(int code)
        {
            this.Code = code;
        }

        public AjaxResultDto(string message, int code)
        {
            this.Message = message;
            this.Code = code;
        }

        public AjaxResultDto(object result, string message, int code)
        {
            this.Result = result;
            this.Message = message;
            this.Code = code;
        }

        /// <summary>
        /// 返回结果
        /// </summary>
        public object Result { get; set; } = "";

        /// <summary>
        /// 返回消息
        /// </summary>
        public string Message { get; set; } = "";

        /// <summary>
        /// 状态 代码
        /// </summary>
        /// <remarks>
        /// 默认：[ 200 执行成功 ]
        /// </remarks>
        public int Code { get; set; } = 200;

        /// <summary>
        /// 时间戳
        /// </summary>
        public double Timestamp
        {
            get
            {
                return DateTimeUtil.GetTimestamp();
            }
        }
    }
}
